import { _decorator, Component, Node } from 'cc';
import { CtrlModeListener } from '../../core/GameInputListeners';
import { InputType } from '../../core/InputConfig';
import GameInputMgr from '../../core/GameInputMgr';

const { ccclass, property } = _decorator;
/**
 * 隐藏一种键盘的操作是比较少见的需求
 */
@ccclass('KeyTipShow')
export class KeyTipShow extends Component implements CtrlModeListener {

    @property
    type: string = InputType.STEAM;

    onChangeMode(mode: string): void {
        this.onLoad();
    }

    onLoad() {
        if (this.type == GameInputMgr.instance().type) {
            this.node.active = true;
        } else {
            this.node.active = false;
        }
        GameInputMgr.instance().addCtrlModeListener(this)
    }

    onDestroy() {
        GameInputMgr.instance().removeCtrlModeListener(this)
    }

    update(deltaTime: number) {

    }
}


